package com.example.myprojectoffeixue;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class Dialog_all extends Activity {
    private SharedPreferences sp;
    MyApplication m;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dialog_all);
        info();
    }
public void info(){

   m= (MyApplication) getApplication();
    TextView tv= (TextView) findViewById(R.id.tv_dialog);
    TextView tv2= (TextView) findViewById(R.id.tv2_dialog);

    tv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            sp = getBaseContext().getSharedPreferences("first", Dialog_all.MODE_PRIVATE);
            sp.edit().putString("Mac", null).commit();
            sp.edit().putString("UserId", null).commit();
            sp.edit().putString("SocketToken", null).commit();
            sp.edit().putBoolean("isexit", true).commit();
            m.userId = null;
            Intent logoutIntent = new Intent(Dialog_all.this, LoginActivity.class);
            logoutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(logoutIntent);
            finish();
        }
    });

    tv2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();

        }
    });

}














}
